<template>
  <div class="comp-search">
    <div class="search-list">
      <div class="address">
        <span>{{ mapArr }}</span>
        <router-link to="/addres">
          <i class="iconfont icon-didian"></i>
        </router-link>
      </div>
      <div class="search">
        <router-link to="/search">
          <i class="iconfont icon-sousuo"></i>
          <input type="text" placeholder="流浪地球" />
        </router-link>
      </div>
      <i class="iconfont icon-xiaoxi"></i>
    </div>
  </div>
</template>

<script>
export default {
  name: "compSearch",
  data() {
    return {
      mapArr: "广州",
    };
  },
  methods: {
    getData() {
      // 城市列表
      // let pro = axios.get("cities.json");
      // 定位
      let pro = axios.get("city/latlng");
      pro
        .then((res) => {
          //  banner轮播推荐
          console.log("请求成功----->", res);
        })
        .catch((err) => {
          console.log("请求失败----->", err);
        });
    },
    // 破防了都
    getSearch() {
      let pro = axios.get("search/movies", {
        params: {
          keyword: "你",
        },
      });
      pro
        .then((res) => {
          //  banner轮播推荐
          console.log("------------>", res);
        })
        .catch((err) => {
          console.log("请求失败----->", err);
        });
    },
  },
  mounted() {
    this.getData();
    this.mapArr = this.$store.state.beforArray || [];
    console.log("-----------", this.$store.state.beforArray);
    // this.getSearch()
    // 初始化
    //  this.mapArr = this.$store.state.selectCity;
    // console.log(this.mapArr);
  },
};
</script>

<style lang="scss" scoped>
.comp-search {
  position: fixed;
  top: 0;
  left: 0;
  height: 44px;
  width: 100%;
  background: rgb(255, 255, 255);

  z-index: 99;
  .search-list {
    height: 44px;
    width: 343px;
    padding: 0 16px;
    margin: 0px auto;
    // background: rgb(255, 255, 255);
    display: flex;
    justify-content: space-between;
    align-items: center;
    // z-index: 99;
    .address {
      width: 70px;
      height: 44px;
      display: flex;
      align-items: center;
      span {
        display: block;
        font-size: 18px;
        height: 44px;
        line-height: 44px;
      }
      a {
        height: 44px;
        line-height: 44px;
        display: flex;
        align-items: center;
        padding: 0 3px;
        i {
          font-size: 20px;
          color: #ccc;
        }
      }
    }
    .search {
      width: 230px;
      height: 44px;

      a {
        width: 230px;
        height: 44px;
        position: relative;
        display: flex;
        align-items: center;
        i {
          font-size: 18px;
          width: 20px;
          height: 100%;
          line-height: 44px;
          position: absolute;
          left: 10px;
          color: #ccc;
        }
        input {
          width: 230px;
          height: 36px;
          border-radius: 20px;
          border: 1px solid #f5f5f5;
          background: #f5f5f5;
          box-sizing: border-box;
          text-indent: 30px;
          font-size: 14px;
        }
      }
    }
    > i {
      font-size: 28px;
      color: #ccc;
      padding: 2px;
      margin-left: 10px;
    }
  }
}
</style>